<div id="right">
<h1>Create Vocabulary</h1>

<?php if(isset($message) == true){?>
<div class="notice">
	<code><?php echo $message; ?></code>
</div>
<?php } ?>
<?php echo validation_errors(); 

 ?>
<?php echo form_open('taxonomy/create'); ?>
    <label for="vocabulary">Name Vocabulary</label>
    <input type="text" name="vocabulary" value="" class="boxtext name_taxonomy" />
    <span style="margin-left: 5px;" class="gray field_clone"></span><br /><br />
<div class="block_value_taxonomy">
    <label for="value_vocabulary">Value Vocabulary</label>
    <input type="text" name="value_vocabulary" value="" class="boxtext value_vocabulary" />
</div>
<br/>
<input type="submit" name="submit" class="button" value="Create"/><br /><br />
</form>
</div>


<script type="text/javascript">
$(document).ready(function(){
    //$(".name_term").appendTo(".field_clone");
   $(".block_value_taxonomy").hide();
    $(".name_taxonomy").keyup(function(event){
        $name_taxonomy   = $(".name_taxonomy").val();
        $(".field_clone").html("<span class='block_clone'>Value Taxonomy: <span clas='field_filter_clone'>"+locdau($name_taxonomy)+"</span> <a href='#' class='edit_name_term'>[Edit]</a></span>");
        $(".value_vocabulary").val(locdau($name_taxonomy));
    });
    $(".edit_name_term").live("click", function()
    {
        $(".block_value_taxonomy").show();
        $(".block_clone").hide();
    })
  function locdau(str) {  
      str= str.toLowerCase();  
      str= str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g,"a");  
      str= str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g,"e");  
      str= str.replace(/ì|í|ị|ỉ|ĩ/g,"i");  
      str= str.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g,"o");  
      str= str.replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g,"u");  
      str= str.replace(/ỳ|ý|ỵ|ỷ|ỹ/g,"y");  
      str= str.replace(/đ/g,"d");  
      str= str.replace(/!|@|%|\^|\*|\(|\)|\+|\=|\<|\>|\?|\/|,|\.|\:|\;|\'| |\"|\&|\#|\[|\]|~|$|_/g,"_"); 
    /* tìm và thay thế các kí tự đặc biệt trong chuỗi sang kí tự - */ 
      str= str.replace(/_+_/g,"_"); //thay thế 2- thành 1- 
      str= str.replace(/^\_+|\_+$/g,"");  
    //cắt bỏ ký tự - ở đầu và cuối chuỗi  
      return str;  
  }   

});
</script>